package web.demo.utils;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class WebUtils {
	public static void goTo(HttpServletRequest request,HttpServletResponse response, Object uri)
		throws IOException, ServletException {
		if(uri instanceof String){	//发送重定向
			response.sendRedirect((String)uri);
		}else if(uri instanceof RequestDispatcher){	//请求转发
			((RequestDispatcher) uri).forward(request, response);
		}
	}
}
